package com.burgeon.backend.SHOP.controller;


import com.burgeon.backend.SHOP.service.AppUserService;
import com.burgeon.backend.SHOPBACKEND.entity.Employee;
import com.burgeon.backend.entity.Store;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;


@RestController
@RequestMapping("shop/info")
public class AppInfoController extends BaseController {
    @Autowired
    private AppUserService appUserService;

    @RequestMapping("store")
    public ResponseResult<List<Store>> GetStore(String city, HttpSession session){
        String token = session.getAttribute("token").toString();
        List<Store> data = appUserService.GetStores(city,token);
        return new ResponseResult<List<Store>>(SUCCESS,data);
    }

    @RequestMapping("emp")
    public ResponseResult<List<Employee>> GetEmp(String id, HttpSession session){
        String token = session.getAttribute("token").toString();
        List<Employee> data = appUserService.GetEmpDataBylog(id, token);
        return new ResponseResult<List<Employee>>(SUCCESS,data);
    }
}
